<!-- $Id: bonus_type_info.htm 14216 2008-03-10 02:27:21Z testyang $ -->

<script type="text/javascript" src="../js/calendar.php?lang={$cfg_lang}"></script>
<link href="../js/calendar/calendar.css" rel="stylesheet" type="text/css" />

{include file="pageheader.htm"}
<div class="main-div">
<form action="bonus.php" method="post" name="theForm" enctype="multipart/form-data" onsubmit="return validate()">
<table width="100%">
  <tr>
    <td class="label">名称</td>
    <td>
      <input type='text' name='type_name' maxlength="30" value="{$bonus_arr.type_name}" size='20' />    </td>
  </tr>
  <tr>
    <td class="label">类型</td>
    <td>
      <input type="radio" name="type" value="0" {if $bonus_arr.type eq 0} checked="true" {/if} onClick="showunit2(0)"  />优惠券
      <input type="radio" name="type" value="1" {if $bonus_arr.type eq 1} checked="true" {/if} onClick="showunit2(1)"  />代金券
  </tr>
  <tr>
    <td class="label"></td>
    <td>
    	<input type="radio" name="money_type" value="0" id="man_radio" {if $bonus_arr.money_type eq 0} checked="true" {/if} onClick="show_money_type(0)" />
      	订单普通商品总额达到<input name="min_goods_amount" type="text" id="man" value="{$bonus_arr.min_goods_amount}" size="10"/>后
    </td>
  </tr>
  <tr>
  	<td class="label"></td>
  	<td>
  		<input type="radio" name="money_type" value="1" id="meiman_radio" {if $bonus_arr.money_type eq 1} checked="true" {/if} onClick="show_money_type(1)" />
  		订单普通商品总额每满<input name="min_goods_amount" type="text" id="meiman" value="{$bonus_arr.min_goods_amount}" size="10" />
  	</td>
  </tr>
  <tr>
    <td class="label">可享受折扣<td>
    <input id="discount" type="text" name="type_discount" value="{$bonus_arr.type_discount}" size="20" />%</td>
  </tr>
  <tr>
    <td class="label">可抵扣金额<td>
    <input id="money" type="text" name="type_money" value="{$bonus_arr.type_money}" size="20" /></td>
  </tr>
  
  <tr>
  	<td class="label">使用分类</td>
  	<td>
  		<select name="cat_id"><option value="0">请选择</option>{$cat_list}</select>
  	</td>
  </tr>
  <!-- <tr>
    <td class="label">{$lang.send_method}</td>
    <td>
      <input type="radio" name="send_type" value="0" {if $bonus_arr.send_type eq 0} checked="true" {/if} onClick="showunit(0)"  />{$lang.send_by[0]}
      <input type="radio" name="send_type" value="1" {if $bonus_arr.send_type eq 1} checked="true" {/if} onClick="showunit(1)"  />{$lang.send_by[1]}
      <input type="radio" name="send_type" value="2" {if $bonus_arr.send_type eq 2} checked="true" {/if} onClick="showunit(2)"  />{$lang.send_by[2]}
      <input type="radio" name="send_type" value="3" {if $bonus_arr.send_type eq 3} checked="true" {/if} onClick="showunit(3)"  />{$lang.send_by[3]}    </td>
  </tr>
  <tr id="1" style="display:none">
    <td class="label">
      <a href="javascript:showNotice('Order_money_a');" title="{$lang.form_notice}">
      <img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}"></a>{$lang.min_amount}</td>
    <td>
      <input name="min_amount" type="text" id="min_amount" value="{$bonus_arr.min_amount}" size="20" />
      <br /><span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="Order_money_a">{$lang.order_money_notic}</span>    </td>
  </tr>
  <tr>
    <td class="label">
      <a href="javascript:showNotice('Send_start_a');" title="{$lang.form_notice}">
      <img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}"></a>{$lang.send_startdate}</td>
    <td>
      <input name="send_start_date" type="text" id="send_start_date" size="22" value='{$bonus_arr.send_start_date}' readonly="readonly" /><input name="selbtn1" type="button" id="selbtn1" onclick="return showCalendar('send_start_date', '%Y-%m-%d', false, false, 'selbtn1');" value="{$lang.btn_select}" class="button"/>
      <br /><span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="Send_start_a">{$lang.send_startdate_notic}</span>    </td>
  </tr>
  <tr>
    <td class="label">{$lang.send_enddate}</td>
    <td>
      <input name="send_end_date" type="text" id="send_end_date" size="22" value='{$bonus_arr.send_end_date}' readonly="readonly" /><input name="selbtn2" type="button" id="selbtn2" onclick="return showCalendar('send_end_date', '%Y-%m-%d', false, false, 'selbtn2');" value="{$lang.btn_select}" class="button"/>    </td>
  </tr> -->
  <tr>
    <td class="label">
	  <a href="javascript:showNotice('Use_start_a');" title="{$lang.form_notice}">
      <img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}"></a>
	{$lang.use_startdate}</td>
    <td>
      <input name="use_start_date" type="text" id="use_start_date" size="22" value='{$bonus_arr.use_start_date}' readonly="readonly" /><input name="selbtn3" type="button" id="selbtn3" onclick="return showCalendar('use_start_date', '%Y-%m-%d', false, false, 'selbtn3');" value="{$lang.btn_select}" class="button"/>
	  <br /><span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="Use_start_a">只有当前时间介于起始日期和截止日期之间时，此卡券才可以使用</span>    </td>
  </tr>
  <tr>
    <td class="label">{$lang.use_enddate}</td>
    <td>
      <input name="use_end_date" type="text" id="use_end_date" size="22" value='{$bonus_arr.use_end_date}' readonly="readonly" /><input name="selbtn4" type="button" id="selbtn4" onclick="return showCalendar('use_end_date', '%Y-%m-%d', false, false, 'selbtn4');" value="{$lang.btn_select}" class="button"/>    </td>
  </tr>
  <tr>
    <td class="label">推广方式</td>
    <td>
      <input type="radio" name="promotion_type" value="0" {if $bonus_arr.promotion_type eq 0} checked="true" {/if} onClick="showunit3(0)"  />管理员发放
      <input type="radio" name="promotion_type" value="1" {if $bonus_arr.promotion_type eq 1} checked="true" {/if} onClick="showunit3(1)"  />用户领取
  </tr>
  <tr class="user_get" style="display:none;">
    <td class="label">发放量<td>
    <input type="text" name="limit_number" value="{$bonus_arr.limit_number}" size="20" />张</td>
  </tr>
  <tr class="user_get" style="display:none;">
    <td class="label">限领</td>
    <td>
      <input type="radio" name="limit_type" value="0" {if $bonus_arr.limit_type eq 0} checked="true" {/if}/>活动期间每人限领1张
      <input type="radio" name="limit_type" value="1" {if $bonus_arr.limit_type eq 1} checked="true" {/if}/>活动期间每人每天限领1张
  </tr>
  <tr class="user_get" style="display:none;">
    <td class="label">领券开始时间</td>
    <td>
      <input name="get_start_date" type="text" id="get_start_date" size="22" value='{$bonus_arr.get_start_date}' readonly="readonly" /><input name="selbtn4" type="button" id="selbtn4" onclick="return showCalendar('get_start_date', '%Y-%m-%d %H:%M', '24', false, 'selbtn4');" value="{$lang.btn_select}" class="button"/>
	 </td>
  </tr>
  <tr class="user_get" style="display:none;">
    <td class="label">领券结束时间</td>
    <td>
      <input name="get_end_date" type="text" id="get_end_date" size="22" value='{$bonus_arr.get_end_date}' readonly="readonly" /><input name="selbtn5" type="button" id="selbtn5" onclick="return showCalendar('get_end_date', '%Y-%m-%d %H:%M', '24', false, 'selbtn5');" value="{$lang.btn_select}" class="button"/>
    </td>
  </tr>
  <tr class="user_get" style="display:none;">
     <td class="label">上传图片</td>
     <td>
       <input type="file" name="img" size="35" />
       {if $bonus_arr.img}
         <a href="goods.php?act=show_image&img_url={$bonus_arr.img}" title="点击查看图片" target="_blank"><img src="images/yes.gif" border="0" /></a>
       {else}
         <img src="images/no.gif" />
       {/if}
       <span class="notice-span" style="display:block">150px * 40px</span>
     </td>
  </tr>
  <tr class="user_get" style="display:none;">
    <td class="label">领取链接</td>
    <td><textarea name="url" id="url" cols="40" rows="5"  readonly="readonly">{$bonus_arr.url}</textarea></td>
  </tr>
  <tr>
    <td class="label">&nbsp;</td>
    <td>
    
      <input type="submit" value="{$lang.button_submit}" class="button" />
      <input type="reset" value="{$lang.button_reset}" class="button" />
      <input type="hidden" name="act" value="{$form_act}" />
      <input type="hidden" name="type_id" value="{$bonus_arr.type_id}" />    </td>
  </tr>
</table>
</form>
</div>
{insert_scripts files="../js/utils.js,validator.js"}
{literal}
<script language="javascript">
<!--
document.forms['theForm'].elements['type_name'].focus();
/**
 * 检查表单输入的数据
 */
function validate()
{
  validator = new Validator("theForm");
  validator.required("type_name",      type_name_empty);
  validator.islt('use_start_date', 'use_end_date', use_start_lt_end);
  return validator.passed();
}
onload = function()
{
  {/literal}
  //get_value = '{$bonus_arr.send_type}';
  get_value = '{$bonus_arr.type}';
  value = '{$bonus_arr.money_type}';
  var promotion_type = '{$bonus_arr.promotion_type}';
  {literal}

  //showunit(get_value)
  showunit2(get_value);
  show_money_type(value);
  showunit3(promotion_type);
  // 开始检查订单
  startCheckOrder();
}
/* 红包类型按订单金额发放时才填写 */
function gObj(obj)
{
  var theObj;
  if (document.getElementById)
  {
    if (typeof obj=="string") {
      return document.getElementById(obj);
    } else {
      return obj.style;
    }
  }
  return null;
}

function showunit(get_value)
{
  gObj("1").style.display =  (get_value == 2) ? "" : "none";
  document.forms['theForm'].elements['selbtn1'].disabled  = (get_value != 1 && get_value != 2);
  document.forms['theForm'].elements['selbtn2'].disabled  = (get_value != 1 && get_value != 2);

  return;
}

function showunit2(get_value)
{
	document.forms['theForm'].elements['type_money'].disabled  = (get_value == 0);
	document.forms['theForm'].elements['type_discount'].disabled  = (get_value == 1);
	document.getElementById('meiman_radio').disabled  = (get_value == 0);
	document.getElementById('meiman').disabled  = (get_value == 0);
	if(get_value == 0){
		document.getElementById('man_radio').checked  = true;
		document.getElementById('man').disabled  = false;
	}else{
		show_money_type(value);
	}
}


function showunit3(get_value)
{
	var tags = document.getElementsByClassName('user_get');
	if(get_value == 0){
		for(var i=0;i<tags.length;i++){//对标签进行遍历 
			tags[i].style.display = 'none'; 
			 
		} 
	}else{
		for(var i=0;i<tags.length;i++){//对标签进行遍历 
			tags[i].style.display = ''; 
			 
		} 
	}
}

function show_money_type(value)
{
	document.getElementById('meiman').disabled  = (value == 0);
	document.getElementById('man').disabled  = (value == 1);
}
//-->
</script>
{/literal}
{include file="pagefooter.htm"}
